In developing a computer program, it is known that securing and releasing processes of a memory region used by a program is likely to cause inconvenience to the program such as referring to an incorrect region. Particularly, in developing a large scale program, it is difficult for a programmer to completely understand all of memory securing and releasing processes.
As means for solving this, NPL 1 discloses a garbage collector which automatically performs memory management in a program. The garbage collector is a function of executing garbage collection (hereinafter, referred to as “GC”) which is a process of determining an unnecessary object and releasing a region taken up by the object among memory regions which are dynamically secured by a program. For example, in Java (registered trademark) which is one of language processing systems with a memory management function using the garbage collector, means for securing a memory region is prepared, and, a Java program developer explicitly describes securing of a memory region such that the garbage collector dynamically performs GC and releases the memory.
An execution form of GC largely includes two methods. There are a method of executing GC in parallel to execution of a Java program and a method of pausing execution of the Java program and executing GC. In the former, a pause time due to GC tends to be shortened although an execution performance of the Java program is reduced. In the latter, a pause time due to GC tends to be lengthened although an execution performance of the Java program increases.
As means for solving the latter, NPL 2 proposes a computer system which has a memory region (hereinafter, referred to as an “external memory region”) other than targets managed by GC as well as a memory region managed by GC. This computer system disposes an object generated in a specific section of a program in the external memory region. The specific section is designated by executing a program which is explicitly described in advance by a program developer.
Description of a program for designating this specific section is exemplified in FIG. 22. A CPU executes “em=new ExplicitMemory( );” in the program so as to secure an external memory region. A designated section is the time when the CPU calls a method “em.enter( );” and then calls a method “em.exit( );” for the generated object “em”. The CPU disposes objects “obj1”, “obj2” and “obj3” which are generated in this designated section, in the secured external memory region. When the secured external memory region is unnecessary, the CPU calls a method “em.reclaim( );” for the generated object “em” so as to release the external memory region.
One of usages of this processing system is to dispose an object group which has a constant life (a period until an object becomes unnecessary after being generated) in an external memory region. Thereby, flow of an object into a Java heap is reduced, and thereby occurrence of GC is suppressed so as to improve a response performance of the processing system.
In addition, NPL 1 described above also discloses a computer system which applies different memory management methods depending on whether an object has a short life or a long life. This computer system divides a Java heap into a short life region and a long life region, manages age information indicating a lifetime of each object, and individually manages GC of each region. First, the CPU disposes all of generated objects in the short life region. When the short life region is depleted, the CPU starts a GC process, and recovers the objects of the short life region. At this time, the CPU increases the ages of the surviving objects by 1. If this age exceeds a threshold value, the CPU regards an object as an object with a long life, and moves the object to the long life region. The long life object is managed in a separate region in this way, and management of the short life region is reduced, thereby improving an execution performance of a program.
In addition, as a computer system which uses the method of managing objects which are divided into short life objects and long life objects like the computer system disclosed in NPL 1, a system which uses a program point for managing an object life is disclosed in NPL 3. The program point is a point (a position of a code generating an object) where a program generates an object in the program generating the object. The computer system analyzes a life of an object, uses the program point when a long life object is generated, and disposes the object in the long life region from the beginning so as to reduce a GC process or movement of an object, thereby improving an execution performance.
More specifically, in the computer system disclosed in NPL 1, which applies different management methods to short life and long life objects, the CPU records an object and a program point where the object is generated in correlation with each other when executing a program. When an object is moved to the long life region, the CPU manages the object as having a long life, and disposes the generated object in the long life region from the beginning when executing again the program point where the object is generated.